//
//  UUfGtoJLCFMineAboutUsViewControlleraRZwfk.m
//  qcb_ios
//
//  Created by Ji on 2018/8/30.
//  Copyright © 2018年 ski. All rights reserved.
//

#import "UUfGtoJLCFMineAboutUsViewControlleraRZwfk.h"
#import "sHkPtEJLCFMineRequestozAYZs.h"
#import "KTdPjIJLCFMineAboutDataModelQJYFdE.h"

@interface UUfGtoJLCFMineAboutUsViewControlleraRZwfk ()

@property (nonatomic, strong) KTdPjIJLCFMineAboutDataModelQJYFdE *yYPVXnaboutModelEOKLRj;

@end

@implementation UUfGtoJLCFMineAboutUsViewControlleraRZwfk

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self addNavigationBar];
    self.navigationBar.title = @"关于我们";
    
    self.view.backgroundColor = QTZ_Gray237;
    
    [self loadData];
    
}

- (void)loadData
{
    
    [sHkPtEJLCFMineRequestozAYZs postAboutDataWithParams:nil loadingInView:nil success:^(KTdPjIJLCFMineAboutDataModelQJYFdE *about) {
        self.yYPVXnaboutModelEOKLRj = about;
        [self configView];
    } failure:^(NSString *error) {
        
    }];
    
}

- (void)configView
{
    
    UIImageView *logo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_mine_login"]];
    logo.centerX = FULL_WIDTH / 2;
    logo.top = 120;
    [self.view addSubview:logo];
    
    UILabel *LufDjKnameLabelRjatWG = [UILabel labelWithText:@"V 1.0" textColor:QTZ_Gray102 font:FONT(15)];
    LufDjKnameLabelRjatWG.centerX = logo.centerX;
    LufDjKnameLabelRjatWG.top = logo.bottom + 5;
    [self.view addSubview:LufDjKnameLabelRjatWG];
    
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(10, LufDjKnameLabelRjatWG.bottom + 36, FULL_WIDTH - 20, 160)];
    bgView.backgroundColor = QTZ_White;
    bgView.layer.cornerRadius = 10;
    bgView.layer.masksToBounds = YES;
    [self.view addSubview:bgView];

    
    
    UILabel *phoneTitleLabel = [UILabel labelWithText:@"客服热线" textColor:QTZ_Gray102 font:FONT(15)];
    phoneTitleLabel.left = 13;
    phoneTitleLabel.centerY = 20;
    [bgView addSubview:phoneTitleLabel];
    
    UILabel *jyvhKwphoneLabelpopXEs = [UILabel labelWithText:self.yYPVXnaboutModelEOKLRj.kefuPhone textColor:RGBA(59, 118, 252, 1) font:FONT(13)];
    jyvhKwphoneLabelpopXEs.right = bgView.width - 13;
    jyvhKwphoneLabelpopXEs.centerY = phoneTitleLabel.centerY;
    jyvhKwphoneLabelpopXEs.userInteractionEnabled = YES;
    [jyvhKwphoneLabelpopXEs bk_whenTapped:^{
        [[JLCFNavigationService sharedService] openUrl:[NSString stringWithFormat:@"tel://%@", self.yYPVXnaboutModelEOKLRj.kefuPhone]];
    }];
    [bgView addSubview:jyvhKwphoneLabelpopXEs];
    [phoneTitleLabel.layer addSublayer:[self addLineOriginPoint:CGPointMake(0, phoneTitleLabel.height + 5) toPoint:CGPointMake(jyvhKwphoneLabelpopXEs.right, phoneTitleLabel.height + 5) color:QTZ_Gray237 borderWidth:1]];
    
    UILabel *qqTitleLabel = [UILabel labelWithText:@"客户QQ群号" textColor:QTZ_Gray102 font:FONT(15)];
    qqTitleLabel.left = 13;
    qqTitleLabel.centerY = 60;
    [bgView addSubview:qqTitleLabel];
    
    UILabel *qqLabel = [UILabel labelWithText:self.yYPVXnaboutModelEOKLRj.kefuQQ textColor:RGBA(59, 118, 252, 1) font:FONT(13)];
    qqLabel.right = jyvhKwphoneLabelpopXEs.right;
    qqLabel.centerY = qqTitleLabel.centerY;
    qqLabel.userInteractionEnabled = YES;
    [qqLabel bk_whenTapped:^{
        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
        pasteboard.string = self.yYPVXnaboutModelEOKLRj.kefuQQ;
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"客服QQ群号已复制到您的剪贴板" message:nil preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleCancel handler:nil];
        [cancel setValue:Theme_Color forKey:@"titleTextColor"];
        [alert addAction:cancel];
        
        [self presentViewController:alert animated:YES completion:nil];
    }];
    [bgView addSubview:qqLabel];
    [qqTitleLabel.layer addSublayer:[self addLineOriginPoint:CGPointMake(0, qqTitleLabel.height + 5) toPoint:CGPointMake(qqLabel.right, qqTitleLabel.height + 5) color:QTZ_Gray237 borderWidth:1]];
    
    UILabel *webTitleLabel = [UILabel labelWithText:@"官方网站" textColor:QTZ_Gray102 font:FONT(15)];
    webTitleLabel.left = 13;
    webTitleLabel.centerY = 100;
    [bgView addSubview:webTitleLabel];
    
    UILabel *webLabel = [UILabel labelWithText:self.yYPVXnaboutModelEOKLRj.web textColor:RGBA(59, 118, 252, 1) font:FONT(13)];
    webLabel.right = jyvhKwphoneLabelpopXEs.right;
    webLabel.centerY = webTitleLabel.centerY;
    webLabel.userInteractionEnabled = YES;
    [webLabel bk_whenTapped:^{
        [[JLCFNavigationService sharedService] openUrl:self.yYPVXnaboutModelEOKLRj.web];
    }];
    [bgView addSubview:webLabel];
    [webTitleLabel.layer addSublayer:[self addLineOriginPoint:CGPointMake(0, webTitleLabel.height + 5) toPoint:CGPointMake(webLabel.right, webTitleLabel.height + 5) color:QTZ_Gray237 borderWidth:1]];
    
    UILabel *wechatTitleLabel = [UILabel labelWithText:@"服务号" textColor:QTZ_Gray102 font:FONT(15)];
    wechatTitleLabel.left = 13;
    wechatTitleLabel.centerY = 140;
    [bgView addSubview:wechatTitleLabel];
    
    UILabel *wechatLabel = [UILabel labelWithText:self.yYPVXnaboutModelEOKLRj.weixin textColor:RGBA(59, 118, 252, 1) font:FONT(13)];
    wechatLabel.right = jyvhKwphoneLabelpopXEs.right;
    wechatLabel.centerY = wechatTitleLabel.centerY;
    wechatLabel.userInteractionEnabled = YES;
    [wechatLabel bk_whenTapped:^{
        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
        pasteboard.string = self.yYPVXnaboutModelEOKLRj.weixin;
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"公众号链接已复制到您的剪贴板" message:nil preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleCancel handler:nil];
        [cancel setValue:Theme_Color forKey:@"titleTextColor"];
        [alert addAction:cancel];
        
        [self presentViewController:alert animated:YES completion:nil];
    }];
    [bgView addSubview:wechatLabel];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (CAShapeLayer *)addLineOriginPoint:(CGPoint)p0 toPoint:(CGPoint)p1 color:(UIColor *)color borderWidth:(CGFloat)borderWidth {
    
    /// 线的路径
    UIBezierPath * bezierPath = [UIBezierPath bezierPath];
    [bezierPath moveToPoint:p0];
    [bezierPath addLineToPoint:p1];
    
    CAShapeLayer * ZLmcEJshapeLayerWDClkp = [CAShapeLayer layer];
    ZLmcEJshapeLayerWDClkp.strokeColor = color.CGColor;
    ZLmcEJshapeLayerWDClkp.fillColor  = [UIColor clearColor].CGColor;
    /// 添加路径
    ZLmcEJshapeLayerWDClkp.path = bezierPath.CGPath;
    /// 线宽度
    ZLmcEJshapeLayerWDClkp.lineWidth = borderWidth;
    return ZLmcEJshapeLayerWDClkp;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view PzfRvYcontrollerLrnibE using [segue destinationViewController].
    // Pass the selected object to the new view PzfRvYcontrollerLrnibE.
}
*/

@end
